</body>
</html>
<script>
    layui.use(['element','layer','laypage'], function(){
        var element = layui.element;
        var laypage = layui.laypage;
        $ = layui.jquery;
        layer = layui.layer;
        resetMenuHeight();
    });
    // 重新设置菜单容器高度
    function resetMenuHeight(){
        var height = document.documentElement.clientHeight - 50;
        $('#menu').height(height);
    }
</script>

<script type="text/javascript">
    function edit(id){
        layer.open({
            type: 2,
            title: '编辑数据',
            shade: 0.3,
            area: ['480px', '440px'],
            content: '/index.php/index/edit?id='+id
        });
    }
</script>

<script type="text/javascript">
    function catedit(id){
        layer.open({
            type: 2,
            title: '编辑分类',
            shade: 0.3,
            area: ['480px', '440px'],
            content: '/index.php/index/catedit?id='+id
        });
    }
</script>

<script type="text/javascript">
    function add(){
        layer.open({
            type: 2,
            title: '添加数据',
            shade: 0.3,
            area: ['480px', '440px'],
            content: '/index.php/index/add'
        });
    }
</script>

<script type="text/javascript">
    function catadd(){
        layer.open({
            type: 2,
            title: '添加数据',
            shade: 0.3,
            area: ['480px', '440px'],
            content: '/index.php/index/catadd'
        });
    }
</script>

<script type="text/javascript">
    function del(id){
        layer.confirm('确定要删除吗？', {
            icon:3,
            btn: ['确定','取消']
        }, function(){
            $.post('/index.php/index/del',{'id':id},function(res){
                if(res.status==0){
                    layer.alert(res.message,{icon:2});
                }else{
                    layer.msg(res.message);
                    setTimeout(function(){window.location.reload();},1000);
                }
            },'json');
        });
    }
</script>

<script type="text/javascript">
    function catdel(id){
        layer.confirm('确定要删除吗？', {
            icon:3,
            btn: ['确定','取消']
        }, function(){
            $.post('/index.php/index/catdel',{'id':id},function(res){
                if(res.status==0){
                    layer.alert(res.message,{icon:2});
                }else{
                    layer.msg(res.message);
                    setTimeout(function(){window.location.reload();},1000);
                }
            },'json');
        });
    }
</script>